package payroll.trans;

import payroll.Employee;
import payroll.PayrollDatabase;
import payroll.Transaction;
import payroll.exception.NoSuchEmployeeException;

public abstract class ChangeEmployeeTransaction implements Transaction {
    private int empId;
    public ChangeEmployeeTransaction(int empId){
        this.empId = empId;
    }
    @Override
    public void execute() {
        Employee e = PayrollDatabase.getEmployee(empId);
        if(e == null)
            throw new NoSuchEmployeeException();
        dochange(e);
    }
    protected abstract void dochange(Employee e);

}
